package com.itheima.stock.controller;

import com.itheima.stock.pojo.domain.DescribeDomain;
import com.itheima.stock.pojo.domain.Stock4MinuteDomain;
import com.itheima.stock.pojo.domain.StockAnInfoDomain;
import com.itheima.stock.pojo.domain.StockRt1;
import com.itheima.stock.service.StockerOutService;
import com.itheima.stock.vo.resp.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api("/api/quot")
@RestController
@RequestMapping("/api/quot")
public class StockOutController {
@Autowired
private StockerOutService stockerOutService;

    /**
     * 大盘数据获取
     * @return
     */
    @ApiOperation(value = "大盘数据获取", notes = "大盘数据获取", httpMethod = "GET")
    @GetMapping("/external/index")
    public R<List> getOuterStockIndex(){
        return stockerOutService.getOuterStockIndex();
    }

    /**
     * like查询根据code
     * @param searchStr
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "searchStr", value = "", required = true)
    })
    @ApiOperation(value = "like查询根据code", notes = "like查询根据code", httpMethod = "GET")
    @GetMapping("/stock/search")
        public R<List> getStockLikeCode(@RequestParam Integer searchStr){
        return stockerOutService.getStockLikeCode(searchStr);
        }

    /**
     * 根据code获取详情
     * @param code
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "string", name = "code", value = "", required = true)
    })
    @ApiOperation(value = "根据code获取详情", notes = "根据code获取详情", httpMethod = "GET")
    @GetMapping("/stock/describe")
    public R<DescribeDomain> getDescribeByCode(@RequestParam("code") String code){
     return stockerOutService.getDescribeByCode(code);
        }

    /**
     * 周k线-bycode
     * @param stockCode
     * @return
     * /////放弃，，，，，，，，，，，，，，，，，，，，，，，，，，，，，，，，，
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "string", name = "stockCode", value = "", required = true)
    })
    @ApiOperation(value = "周k线-bycode", notes = "周k线-bycode", httpMethod = "GET")
    @GetMapping("/screen/weekkline")
    private R<List> getScreenWeekkline(@RequestParam("code") String stockCode){
        return stockerOutService.getScreenWeekkline(stockCode);
        }

    /**
     * 个股最新分时行情数据接口分析
     * @param stockCode
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "string", name = "stockCode", value = "", required = true)
    })
    @ApiOperation(value = "个股最新分时行情数据接口分析", notes = "个股最新分时行情数据接口分析", httpMethod = "GET")
    @GetMapping("/stock/screen/second/detail")
    public  R<StockRt1> getScreenSecondDetail(@RequestParam("code") String stockCode){
        return stockerOutService.getScreenSecondDetail(stockCode);
    }

    /**
     * 个股查询最新交易流水
     * @param stockCode
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "string", name = "stockCode", value = "", required = true)
    })
    @ApiOperation(value = "个股查询最新交易流水", notes = "个股查询最新交易流水", httpMethod = "GET")
    @GetMapping("/stock/screen/second")
    public R<List<StockAnInfoDomain>> getScreenSecond(@RequestParam("code") String stockCode){
        return stockerOutService.getScreenSecond(stockCode);
    }

}
